import { Router } from 'hyper-express';
import requireUser from '../../middlewares/auth/requireUser';
import cache from '../../middlewares/cache';
//#region AutoCreateCode
import { EntityController } from '../../controllers';
const entityRouter = new Router();
const entityController = new EntityController();

entityRouter.post('/add', requireUser, entityController.add);
entityRouter.post('/edit', requireUser, entityController.edit);
entityRouter.post('/del', requireUser, entityController.delete);

//For getting entity no auth required
entityRouter.get('/:id', needRequireUser, needCache, entityController.getSingle);
entityRouter.get('/:limit/:page', needRequireUser, needCache, entityController.getMany);
entityRouter.get('/:limit/:page/:skip', needRequireUser, needCache, entityController.getMany);

//#endregion AutoCreateCode
export default entityRouter;
